<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/global.jsp" %>
<html>
<head>
    <%@ include file="/commons/basejs.jsp" %>
    <meta charset="utf-8">
    <title>花语花坊后台管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="icon" href="${path}/static/images/9012521.jpg">
    <link rel="stylesheet" href="${path}/static/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="${path}/static/css/iconfont1/iconfont.css" media="all">
    <link rel="stylesheet" href="${path}/static/css/index.css" media="all" />
</head>
<body class="main_body" onload="showTime()">
<div class="layui-layout layui-layout-admin">
    <!-- 顶部 -->
    <div class="layui-header header">
        <div class="layui-main">

            <a href="${path}/index" class="logo"><img style="width: 60px;height: 60px;border-radius: 5px" src="${path}/static/images/9012521.jpg"></a>
            <!-- 显示/隐藏菜单 -->
            <a href="javascript:;" class="iconfont1 hideMenu icon-toggle"></a>
            <%-- 当前时间 --%>
            <div id="div_time"></div>

            <!-- 顶部右侧菜单 -->
            <ul class="layui-nav top_menu layui-layout-right" style="padding-right: 70px">
                <li class="layui-nav-item showNotice" id="showNotice" pc>
                    <a href="javascript:;"><cite>欢迎登录系统</cite></a>
                </li>
<%--
                <li class="layui-nav-item" mobile>
                    <a href="javascript:;" class="mobileAddTab" data-url="${path }/user/editPwdPage"><i class="iconfont1 icon-xiugaimima1" data-icon="icon-xiugaimima1"></i><cite>修改密码</cite></a>
                </li>--%>
                <li class="layui-nav-item" mobile>
                    <a href="${path}/logout" class="signOut"><i class="iconfont1 icon-tuichu1"></i> 退出登录</a>
                </li>
                <li class="layui-nav-item" pc>
                    <a href="javascript:;">
                        <i class="layui-icon">&#xe612;</i>
                        <shiro:principal property="name"></shiro:principal>
                    </a>
                    <dl class="layui-nav-child">
                       <%-- <dd><a href="javascript:;" data-url="${path}/user/personFile"><i class="iconfont1 icon-iconzhanghunor01" data-icon="icon-iconzhanghunor01"></i><cite> 个人资料</cite></a></dd>
                        <dd><a href="javascript:;" data-url="${path}/user/editPwdPage"><i class="iconfont1 icon-xiugaimima1" data-icon="icon-xiugaimima1"></i><cite> 修改密码</cite></a></dd>--%>
                        <dd><a  href="${path}/logout" class="signOut"><i class="iconfont1 icon-tuichu1"></i><cite> 退出登录</cite></a></dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>
    <!-- 左侧导航 -->
    <div class="layui-side layui-bg-black" id="box0">
        <div class="navBar" id="navBarnavBar">
            <li class="layui-nav-item layui-nav-itemed" style="display: none;z-index: auto">
                <a href="javascript:;" data-url="http://localhost:9090/RMS/main">
                    <i class="iconfont1 icon-houtai" data-icon="icon-houtai">
                    </i>
                    <cite>&nbsp;后台首页</cite>
                </a>
            </li>

        </div>
    </div>
    <!-- 右侧内容 -->
    <div class="layui-body layui-form">
        <div class="layui-tab marg0" lay-filter="bodyTab" id="top_tabs_box">
            <ul class="layui-tab-title top_tab" id="top_tabs">
                <li class="layui-this" lay-id=""><i class="iconfont1 icon-tianchongxing-"></i><cite>&nbsp;后台首页</cite></li>
            </ul>
            <!-- 当前页面操作 -->
            <ul class="layui-nav closeBox">
                <li class="layui-nav-item" pc>
                    <a href="javascript:;"><i class="iconfont1 icon-caozuo"></i> 页面操作</a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:;" class="refresh refreshThis"><i class="layui-icon">&#x1002;</i> 刷新当前</a></dd>
                        <dd><a href="javascript:;" class="closePageOther"><i class="iconfont1 icon-jujue"></i> 关闭其他</a></dd>
                        <dd><a href="javascript:;" class="closePageAll"><i class="iconfont1 icon-guanbi"></i> 关闭全部</a></dd>
                    </dl>
                </li>
            </ul>
            <div class="layui-tab-content clildFrame">
                <div class="layui-tab-item layui-show">
                    <iframe src="${path}/main"></iframe>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 移动导航 -->
<div class="site-tree-mobile layui-hide"><i class="layui-icon">&#xe602;</i></div>
<div class="site-mobile-shade"></div>

<script type="text/javascript" src="${path}/static/layui/layui.js"></script>
<script type="text/javascript" src="${path}/static/js/index.js"></script>
<%--<script type="text/javascript" src="${path}/static/js/leftNav.js"></script>--%>
<script>
    /*jquery载入事件写法*/
    $(function () {/*页面载入事件，加载页面就会触发*/
        //var user=getUser();
        //getMenu(user.adminid);/*根据角色id获取菜单*/
        var pathName=document.location.pathname;
        console.log("pathName="+pathName);
        //alert("pathName="+pathName);
        var index=pathName.substr(1).indexOf("/");
        var result=pathName.substr(0,index+1);
        console.log(result);

        var userStr='<%=session.getAttribute("userStr")%>';
        var userObj=JSON.parse(userStr);/*把json字符串解析为json对象*/
        console.log(userStr);
        console.log(userObj.rolemid);
        $.ajax({
            url:result+"/getMenuList",
            type:"get",
            data:{rolePid:userObj.rolemid},
            dataType:"json",
            success:function (result) {

                var menu_content="";
                var menu_content='<ul class="layui-nav layui-nav-tree">';
                for (var i=0;i<result.length;i++) {
                    var mainMenu = result[i].mainMenu;
                    var subMenu = result[i].subMenu;

                    menu_content += '<li class="layui-nav-item">';

                    menu_content += '<a href="javascript:;">';
                    menu_content += '<i class="iconfont1 '+mainMenu.icon+'" data-icon="'+mainMenu.icon+'">';
                    menu_content += '</i>';
                    menu_content += '<cite>&nbsp;'+mainMenu.title+'</cite>';
                    menu_content += '<span class="layui-nav-more"></span>';
                    menu_content += '</a>';


                    /!*子菜单*!/
                    menu_content += '<dl class="layui-nav-child">';
                    for (var j = 0; j < subMenu.length; j++) {
                        menu_content += '<dd>';
                        menu_content += '<a href="javascript:;"'+' data-url="http://localhost:9090/homeflower/'+subMenu[j].url+'">';
                        menu_content += '<i class="iconfont1 '+subMenu[j].icon+'" data-icon="'+subMenu[j].icon+'"></i>';
                        menu_content += '<cite>&nbsp;'+subMenu[j].title+'</cite>';
                        menu_content += '</a>';
                        menu_content += '</dd>';

                    }

                    menu_content += '</dl>';
                    menu_content += '</li>';
                }
                menu_content += '</ul>';

                /*$("#navBarnavBar").append(menu_content);*/
                $("#navBarnavBar").append(menu_content);
            }
        })
    });
</script>
</body>
</html>
